package main

import "fmt"

func sqrt(x float64) float64 {
	z := x / 2
	var tmp float64 = x
	for z-tmp < -1e-10 || z-tmp > 1e-10 {
		tmp = z
		z -= (z*z - x) / (2 * z)
		fmt.Println(z)
	}

	return z
}

func main() {
	fmt.Println(sqrt(2))
}
